package com.guigusuqi.hy.controller;

import com.guigusuqi.commonutils.vo.Result;
import com.guigusuqi.hy.dto.DeleteList;
import com.guigusuqi.hy.dto.IntegralDetailDto;
import com.guigusuqi.hy.entity.IntegralDetail;
import com.guigusuqi.hy.service.IntegralDetailService;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author:luzheng
 * @data:2022/4/4 18:37
 * @description:
 */
@RestController
@RequestMapping("/hy/integralDetail")
@Api(tags = "wx-积分细节相关CRUD")
public class IntegralDetailController
{
    @Resource
    private IntegralDetailService integralDetailService;

    @PostMapping("/getIntegralDetail/{pageNum}/{pageSize}")
    @ApiOperation(value = "分页获取所有积分详情,可以根据条件模糊查新")
    public Result getIntegralDetail(@PathVariable Integer pageNum,
                                    @PathVariable Integer pageSize,
                                    @ApiParam("用户卡查询条件")
                                    @RequestBody(required = false) IntegralDetailDto integralDetailDto)
    {
        return integralDetailService.getIntegralDetail(pageNum,pageSize,integralDetailDto);
    }

    @PostMapping("/addIntegralDetail")
    @ApiOperation(value = "新增或者更新积分详情,如果三个属性都一样，则无法添加,需要登入")
    public Result addIntegralDetail(@RequestBody IntegralDetail integralDetail)
    {
        return integralDetailService.addIntegralDetail(integralDetail);
    }

    @DeleteMapping("/deleteIntegralDetail")
    @ApiOperation(value = "根据ID批量删除积分详情")
    public Result deleteIntegralDetail(@RequestBody DeleteList deleteList)
    {
        return integralDetailService.deleteIntegralDetail(deleteList);
    }
}
